using System; 
using System.Collections.Generic; 
using System.Text; 
using FluentNHibernate.Mapping;
using Managistics.Model; 

namespace Managistics.Model.Mappings {
    
    
    public class ItemsMap : ClassMap<Items> {
        
        public ItemsMap() {
			Table("ITEMS");
			LazyLoad();
			Id(x => x.ItemId).GeneratedBy.Assigned().Column("ITEM_ID");
			References(x => x.ItemType).Column("ITEM_TYPE_ID");
			References(x => x.UnitItem).Column("UNIT_ITEM_ID");
			Map(x => x.ProductCode).Column("PRODUCT_CODE").Length(20);
			Map(x => x.ProductName).Column("PRODUCT_NAME").Length(50);
			Map(x => x.OrderCode).Column("ORDER_CODE").Length(20);
			Map(x => x.Supplierid).Column("SUPPLIERID").Not.Nullable().Length(20);
			Map(x => x.ItemName1).Column("ITEM_NAME_1").Not.Nullable().Length(300);
			Map(x => x.ItemName2).Column("ITEM_NAME_2").Length(300);
			Map(x => x.WarrantyPeriod).Column("WARRANTY_PERIOD").Length(50);
			Map(x => x.DescriptionItem).Column("DESCRIPTION_ITEM").Length(200);
			Map(x => x.WeightItem).Column("WEIGHT_ITEM").Length(20);
			Map(x => x.SizeItem).Column("SIZE_ITEM").Length(20);
			Map(x => x.VatItem).Column("VAT_ITEM").Precision(5);
			Map(x => x.NoteItem).Column("NOTE_ITEM").Length(200);
			Map(x => x.SellPriceNotIncludeVat).Column("SELL_PRICE_NOT_INCLUDE_VAT").Precision(53);
			Map(x => x.QuantityInCarton).Column("QUANTITY_IN_CARTON").Precision(10);
			Map(x => x.MinQtyOfStock).Column("MIN_QTY_OF_STOCK").Precision(53);
			Map(x => x.Colour).Column("COLOUR").Length(20);
			Map(x => x.InStock).Column("IN_STOCK").Not.Nullable().Precision(53);
			Map(x => x.BuyPriceNotIncludeVat).Column("BUY_PRICE_NOT_INCLUDE_VAT").Not.Nullable().Precision(53);
			Map(x => x.Convertunit).Column("ConvertUnit").Precision(10);
			Map(x => x.Paritycode).Column("ParityCode").Length(6);
			HasMany(x => x.Customs).KeyColumn("ITEM_ID");
			HasMany(x => x.DetailInputSheetDomestic).KeyColumn("ITEM_ID");
			HasMany(x => x.DetailInputSheetOversea).KeyColumn("ITEM_ID");
			HasMany(x => x.DetailIntputSheetTd).KeyColumn("ITEM_ID");
			HasMany(x => x.DetailOrderCus).KeyColumn("ITEM_ID");
			HasMany(x => x.DetailOrderNn).KeyColumn("ITEM_ID");
			HasMany(x => x.DetailOrderTd).KeyColumn("ITEM_ID");
			HasMany(x => x.DetailOutputSheetTd).KeyColumn("ITEM_ID");
			HasMany(x => x.DetailReturnItem).KeyColumn("ItemID");
			HasMany(x => x.DetailReturnItemNn).KeyColumn("ItemID_NN");
			HasMany(x => x.IoOrderThuduc).KeyColumn("ITEM_ID");
        }
    }
}
